$(document).ready(function() {
	InitIndustryTable();
	AddStandard();
})

/**
 * @description
 *   初始化行业标准
 * @author xwt
 * @createDate 2017.1.6
 * @version V0.0.1
 */
function InitIndustryTable() {
	new Vue({
		el: ".indestry_table",
		methods: {
			DeleteStandard(e) { //删除
				var el = e.currentTarget;
				this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					var that = this;
					var id = $(el).parent().parent().next().text();
					$.ajax({
						url: '/hybz/delete',
						type: 'get',
						data: "id=" + id,
						cache: false,
						contentType: false, //不可缺参数
						processData: false, //不可缺参数
						success: function(datas) {
							$(el).parent().parent().parent().remove(); //删除
							that.$message({
								type: 'success',
								message: '删除成功!'
							});
						}
					})
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},
			EditStandard(e) {
				var el = e.currentTarget;
				var id = $(el).parent().parent().next().text();
				window.location.href = "/AddIndustryStandard?type=edit&id=" + id;
			}
		},
		data() {
			var data = {
				seen: true
			};
			$.ajax({
				type: 'get',
				async: false,
				url: "/hybz/getdata",
				//dataType:'json',
				success: function(datas) {
					var data_json = eval('(' + datas + ')');
					$.each(data_json, function(k, v) {
						v.numberw = k + 1;

					});
					data.IndustryData = data_json;
				}
			});
			return data;
		}
	})
}

function AddStandard() {
	//新增行业标准
	var app = new Vue({
		el: '.add_header',
		methods: {
			AddNewStandard: function() {
				window.location.href = "/AddIndustryStandard?type=add";
			}
		}
	})
}

function GetData() {

}